//
//  BQTopTableViewCell.m
//  BeeQuick
//
//  Created by AaronWei on 2017/7/13.
//  Copyright © 2017年 BecomeRich. All rights reserved.
//

#import "BQTopTableViewCell.h"
#import "BQProductModel.h"

@interface BQTopTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imgImageView;

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *priceLabel;

@property (weak, nonatomic) IBOutlet UILabel *marketPriceLabel;

@end

@implementation BQTopTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(BQProductModel *)model {
    
    _model = model;
    
    [self.imgImageView sd_setImageWithURL:[NSURL URLWithString:model.img]];
    
    self.nameLabel.text = model.name;
    
    self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f", model.price];
    
    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"¥%.2f", model.market_price] attributes:attribtDic];
    
    self.marketPriceLabel.attributedText = attribtStr;
    
}

@end
